package org.outlook.test.ui;

import java.awt.Color;
import java.awt.Font;

import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.StyleSheet;

public class BasicDocument extends HTMLDocument {

	private static final long serialVersionUID = 1L;

	/** The host, that is where we are rendering. */
	// private JComponent host;

	public BasicDocument() {
	}

	BasicDocument(StyleSheet s, Font defaultFont, Color foreground) {
		super(s);
		setPreservesUnknownTags(false);
		setFontAndColor(defaultFont, foreground);
	}

	/**
	 * Sets the default font and default color. These are set by adding a rule
	 * for the body that specifies the font and color. This allows the html to
	 * override these should it wish to have a custom font or color.
	 */
	private void setFontAndColor(Font font, Color fg) {
		getStyleSheet().addRule(
				sun.swing.SwingUtilities2.displayPropertiesToCSS(font, fg));
	}
}
